﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Sockets;
using System.Net;

namespace MulticastTestClient
{
    class Program
    {
        //static void Main(string[] args)
        //{
        //    Socket s = new Socket(AddressFamily.InterNetwork,
        //        SocketType.Dgram, ProtocolType.Udp);
        //    IPAddress ip = IPAddress.Parse("224.5.6.7");
        //    s.SetSocketOption(SocketOptionLevel.IP,
        //    SocketOptionName.AddMembership, new MulticastOption(ip));
        //    s.SetSocketOption(SocketOptionLevel.IP,
        //            SocketOptionName.MulticastTimeToLive, 2);
        //    IPEndPoint ipep = new IPEndPoint(ip, 9988);
        //    s.Connect(ipep);
        //    // This creates the letters ABCDEFGHIJ
        //    byte[] b = new byte[10];
        //    for (int x = 0; x < b.Length; x++) b[x] = (byte)(x + 65);

        //    s.Send(b, b.Length, SocketFlags.None);

        //    s.Close();

        //}

        static void Main(string[] args)
        {
            UdpClient sender = new UdpClient();
            IPEndPoint groupEP = new IPEndPoint(IPAddress.Parse("224.5.6.7"), 9988);
            byte[] b = new byte[10];
            for (int x = 0; x < b.Length; x++) b[x] = (byte)(x + 65);

            sender.Send(b, b.Length, groupEP);

        }
    }
}
